<?php

declare(strict_types=1);

namespace App\Controller\Cloudh5;
use App\Controller\AbstractController;
use Hyperf\HttpServer\Annotation\RequestMapping;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\Middleware;
use App\Middleware\RequestCloudh5ApiMiddleware;
use Hyperf\HttpServer\Contract\RequestInterface;
use App\Service\Cloudh5Service\SupplierOrderService;

/**
 * 云仓H5移动端订单列表
 * @Controller(prefix="/Cloudh5/SupplierOrder")
 * @Middleware(RequestCloudh5ApiMiddleware::class) 
 */
class SupplierOrderController extends AbstractController
{
    /**
     * @Inject
     * @var SupplierOrderService
     */
    protected $SupplierOrderService;
  
    /**
     * 获取待售后审核数
     * @RequestMapping(path="getOrderAfterSaleCount", methods="post")
     */
    public function getOrderAfterSaleCount()
    {
        return $this->SupplierOrderService->getOrderAfterSaleCount();
    }
     /**
     * 获取售后订单列表
     * @RequestMapping(path="orderAfterSaleList", methods="post")
     * @param RequestInterface $request
     */
    public function orderAfterSaleList(RequestInterface $request)
    {
        return $this->SupplierOrderService->orderAfterSaleList($request->getAttribute('param')['body']);
    }

    /**
     * 订单售后
     * @RequestMapping(path="orderAfterVerify", methods="post")
     * @param RequestInterface $request
     */
    public function orderAfterVerify(RequestInterface $request)
    {
        $manager = $request->getAttribute('param')['manager'];
        $body    = $request->getAttribute('param')['body'];
        return $this->SupplierOrderService->orderAfterVerify($manager,$body);
    }
    
    /**
     * 订单售后详情
     * @RequestMapping(path="orderAfterVerifyDetail", methods="post")
     * @param RequestInterface $request
     */
    public function orderAfterVerifyDetail(RequestInterface $request)
    {
        $manager = $request->getAttribute('param')['manager'];
        $body    = $request->getAttribute('param')['body'];
        return $this->SupplierOrderService->orderAfterVerifyDetail($manager,$body);
    }
    
    /**
     * 订单详情
     * @RequestMapping(path="OrderDetail", methods="post")
     * @param RequestInterface $request
     */
    public function OrderDetail(RequestInterface $request)
    {
        return $this->SupplierOrderService->OrderDetail((string)$request->getAttribute('param')['body']['orderId']);
    }
}
